import {
    Toast
} from 'vant';

export function doMessageClick(item) {
    if (item.TemplateCode == "DangerAssign") {
        this.$router.push({
            path: "/Danger/DangerCheckDetailAssignDetail",
            query: { id: item.RecordID },
        });
    } else if (item.TemplateCode == "DangerFormulate") {
        this.$router.push({
            path: "/Danger/MyMeasuresToDetail",
            query: { id: item.RecordID },
        });
    } else if (item.TemplateCode == "DangerCorrective") {
        this.$router.push({
            path: "/Danger/MyCorrectivedDetail",
            query: { id: item.RecordID },
        });
    } else if (item.TemplateCode == "DangerVerify") {
        this.$router.push({
            path: "/Danger/DangerCheckTaskDetailVerifyDetail",
            query: { id: item.RecordID },
        });
    } else if (item.TemplateCode == "DangerPlanTask") {
        this.$router.push({
            path: "/Danger/DangerCheckTaskEdit",
            query: { id: item.RecordID },
        });
    } else if (item.TemplateCode == "DangerHiddenDanger") {
        this.$router.push({
            path: "/Danger/DangerCheckTaskDetailEdit",
            query: { id: item.RecordID },
        });
    } else if (item.TemplateCode == "DangerHiddenDangerBack") {
        this.$router.push({
            path: "/Danger/DangerCheckTaskDetailEdit",
            query: { id: item.RecordID },
        });
    } else if (item.TemplateCode == "ExamAlloc") {
        this.$router.push({
            path: "/Train/ExExamExplain",
            query: { id: item.RecordID },
        });
    } else if (item.TemplateCode == "TrainPlanAlloc") {
        this.$router.push({
            path: "/Train/TrainingplanDetail",
            query: { id: item.RecordID },
        });
    } else if (item.TemplateCode == "WHMeasuresForAcceptance") { //措施验收
        this.$router.push({
            path: "/whInvestigationReportLogRMBrowseDetail",
            query: { id: item.RecordID, state: "ForAcceptance" },
        });
    } else if (item.TemplateCode == "WHMeasuresToRectify" || item.TemplateCode == "WHMeasuresForAcceptanceBack") { //措施退回验收&& 措施整改
        this.$router.push({
            path: "/whInvestigationReportLogRMBrowseDetail",
            query: { id: item.RecordID, state: "RectificationMeasures" },
        });
    } else if (item.TemplateCode == "WHInvestigationReportAssistance" || item.TemplateCode == "WHAccidentInvestigationReport") { //调查报告协助 && 调查组长指派
        this.$router.push({
            path: "/whInvestigationReportAccidentInvestigate",
            query: {},
        });
    } else if (item.TemplateCode == "WHAccidentInitialReport") { //	初始报告提交指派
        this.$router.push({
            path: "/whAccidentInitialReportToBeAssignedList",
            query: {},
        });
    } else if(item.TemplateCode == 'JGDangerFormulate'){
        this.$router.push({
            path: "/Danger/JGFormulatedDetail",
            query: {id:item.RecordID},
        });

    }else if(item.TemplateCode == 'JGDangerCorrective'){
        this.$router.push({
            path: "/Danger/JGWindowCorrectiveDetail",
            query: {id:item.RecordID},
        });

    }else if(item.TemplateCode == 'JGDangerVerify'){
        this.$router.push({
            path: "/Danger/DangerCheckTaskEdit",
            query: {id:item.RecordID},
        });

    }else if(item.TemplateCode == 'JGDangerSubmitTask'){
        this.$router.push({
            path: "/Danger/DangerCheckTaskEdit",
            query: {id:item.RecordID},
        });

    }
    else {
        if (item.MobileUrl) {
            let url = item.MobileUrl;
            if (url.includes("/h5/#/")) {
                url = url.substring(6);
            }
            this.$router.push({
                path: url,
            });
        } else {
            console.log(item.TemplateCode + "|" + item.Controller);
            Toast.fail("暂未支持导航，请在电脑端查看")
        }
    }
}